<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>数组去重</title>
    </head>
    <body>
        <script>
            function remove(arr,item){
            return arr.filter(function(e){
                return e!=item;
            });
            }
        var arr = ['1','2','3','4','2','5','6','2','7','2'];
        document.write(arr+'<br/>');
            document.write("需求分析1题计算结果"+remove(arr,2)+'<br/>');
        var array = [4, 6, 0, 3, 0, 0, 0, 1, 3];
        var newArray = [];
        for (var i = 0; i < array.length; i++){
            if (array[i] !== 0) {
                newArray[newArray.length] = array[i];
            }
        }
        document.write(array);
        document.write('</br>'+"需求分析2题计算结果"+newArray)
        </script>
    </body>
    </html>